package Detector;


import java.util.Random;

public class DetectorGame {
    int[][] tablero = new int[20][20];
    DetectorModel detector;
    
    public DetectorGame(DetectorModel detector){
    	this.detector=detector;
    }
    public void initializeGame(){
    	
    	for(int i=0;i<20;i++){
    		for(int j=0;j<20;j++){
    			tablero[i][j]=0;
    		}
    	}
    	
    	Random generator = new Random();
    	int x = generator.nextInt(20);
    	int y = generator.nextInt(20);
    	tablero[x][y]=1;
    	
    	int n=x;
    	int m=y;
    	while (n==x && m==y){
    		n = generator.nextInt(20);
        	m = generator.nextInt(20);
    	}
    	
    	detector.setX(n);
    	detector.setY(m);
    	
    	
    	detector.initialize();
        detector.on((int)(calcularDistancia(x-n,y-m)));
    }
    
    public double calcularDistancia(int difx, int dify){
    	return Math.sqrt(Math.pow(difx,2)+Math.pow(dify,2));
    }
	
    public int getValue(int x, int y){
    	return this.tablero[x][y];
    }
   
    public void dig(){
    	//if()
    }
}
